package utils

import (
	"fmt"
	alipay "github.com/smartwalle/alipay/v3"
	"os"
)

var (
	appID = "2021000120615296"

	privateKey   = "MIIEowIBAAKCAQEAn7kWd+6GCZJ0QED03lwXYIp0dyOZdzbhb1cfTYMYZKrsZ/s7mFCbrquVYot+6e8sdb9UbjxKHf0a9BOicYPXJWMxwOQXBBwycoJyMUH/6sUbXamOMDDC4xJol7csxAyrxzBiotl3ZoV1MKZOjjAQYKRGWDSF/UC0YFirjxbQhDcaNiBQZUns3IQ+KigezJSaLW/ZU6qONbiVEwl7liO7jxC0TlxBJ75WS8LH/VvM3oq4dZtVbTYqxbJZGvyjfwA3MbIenLfzyoHcNn4RGDidbdk7ITSd5yAomqaoW/7R58lKXbF2COH3CxBbp5mTNDzimADoBoQcRMI2wyvTckfdxQIDAQABAoIBAQCCrVjPqMvrOvJ3u21cG7ZYmw6shujBW5pXkM0girhDbIBclnTsqk6lOubOqFieprsWXwKB6juti24o8YN/IiG9Cgojybl2+Gbhvw4UdO4fs0IvgFC/5rUcOOxv7ELo54EHR/P7TrbcnyYBNp+gv3w2xVB0TAyv5edtyD4cpMrW0D35p+9HfY6xgqJwKr8NpB9hHUUjmMyciUnwKeT0qOZWHsIjBel9Ux4YYc3gqxZD2i0T01YVkS4S43nBZ0uI57e+apRnqgNQdO4bABRROBTwO5/Mz4GbPGCvtX9biRLPU9ehI+uqGE4LgjIpKeLxA55ejwsSF/dDbE1vCOVNSPMFAoGBAN5GvMDbQNza5n0QkPxSEXnOngZJwIghdaBBaO3XlEMijfVvnvf5HgmSfIfwPMWTnDqEMipSfa20+HjwO1LCAQNDUEorm9Z/AIawVxCuOgsywRZoUODIbe+Rbn+owf8qi1Zidtj2pdXrFYbuVqsrCOjCT3NTsjDPpI/Nj6yoTMfHAoGBALf0w+2UPTetPHiHlS5OyEshB9m/V7mJ6J802aBqHachyl2T7b00UHvNTbnIVhGCoMKF2vZmYm+cVRzyL/8W/5dc3Zkh+zMbaA46VCvDsI5rWf3/4kVg5gGwwM2CKMEvv63g56ion+x+Fl8VuQGQtoHFePUBfPFbWHWg4GtgpqYTAoGAK/A5wbnVsZLH+zL6JhanA7gXPtD3cTGECgDEGDgEQ90hyMGe4A/royLE4S5ZJQlP2bVmIT2bQGpEr8t1Pp/BCX8V8QN708PZO8bB/zchnDMVPjOywSx9ptzNxgh7CNDFKHdgXPUsxQOqhri4gy+HnFNE11xVHhb9xbtxykSeoOMCgYB1lvPrmZfsUEPYdCrreBbW151yFrsX8k0OADWhMlQUMyht2xLcoGVWTi2CNcq21L64ueH3IgmIePF7WGFP+b6WXhmVOsCdscY5WhXWB/iDgaH8GKbmXIOKzxbgB3TP0RsBJkRPbsMT5KGeVH93va68k6O3UiUxD4gjYRwz54t/mwKBgA8b7Lyw2qHuFTxGm/3+DnIorVuTvYxaKwBzpNoFh6mlcTEyLXMkG5v48sJWeadohGdQ08OJKJ2J1QgIaD6ZBCBpSWW9pPcw29wrfQJgjkz68n5WhcS0x8o3y1jqptFIXM+h2d9yHZ2HGgPovjHgeyndxa5nVkSKp3EfdYhOdD50"
	aliPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnXHeUM9kx6UkSVLeqNwOM9CNw0OodhkcOXBYO4WtD8RAVUjGb41CofPD1DYwVpfV9OVqobExgK1Jhuug+4g5VmOCxet/s9FXZzx5TfMNqvapoZp0HhwEFfEu4FRnhPsa8lgvzzWAJuoASbA6M3DLuadi6U/MKpZcy/isfefiy3+Hcp8ntWeEVaHnhmtO1pw6vDhAH9W2zFBjd1BnVsaBTIbDXI2mO6WeOALbsNJTUsRGXMtalamC24YejipewLxInQ8EJvyiHDm3NvQkFhn2bjBLfg6f1QVCo67+xzH7LrSPIq/nx45nSQSTCNg46+0OoG5gOjeOtCaT0OOreIH/WQIDAQAB"
)

var Client *alipay.Client

func Init() {
	var err error
	Client, err = alipay.New(appID, privateKey, false)

	if err != nil {
		fmt.Println("初始化支付宝失败, 错误信息为", err)
		os.Exit(-1)
	}
	Client.LoadAliPayPublicKey(aliPublicKey)
}
